package net.itbaiyang.pattern.email.bridge.mailType;

import net.itbaiyang.pattern.model.EmailDetails;
import org.springframework.mail.javamail.MimeMessageHelper;

public class SimpleMail implements MailStencil {
    private String to;
    private String subject;
    private String content;

    public SimpleMail(EmailDetails details) {
        this.to = details.getTo();
        this.subject = details.getSubject();
        this.content = details.getContent();
    }

    @Override
    public void apply(MimeMessageHelper helper) throws Exception {
        helper.setTo(to);
        helper.setSubject(subject);
        helper.setText(content, false); // 纯文本
    }
}
